<?php

namespace Acme\DomotiqueBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;

use Acme\DomotiqueBundle\Entity\ArduinoConfig;
use Acme\DomotiqueBundle\Modele\Thermostat;


/**
 * Interface graphique de gestion
 */
class FrontController extends Controller
{

	public function mainAction(){

		$rooms = json_decode($this->forward("DomotiqueBundle:Room:getAll")->getContent())->rooms;
		$elements = json_decode($this->forward("DomotiqueBundle:Element:getAll")->getContent())->elements;

		$thermostats["chambre"] = new Thermostat("chambre");
		$thermostats["mezzanine"] = new Thermostat("mezzanine");

		$vars = array(
			"rooms" => $rooms, 
			"elements" => $elements, 
			"thermostats" => $thermostats
		);
		return $this->render('DomotiqueBundle:Front:main.html.php', $vars);
	}
	public function pilotAction()
	{
		
		$vars = array(
			"elements" => $elements
		);
		return $this->render('DomotiqueBundle:Elements:commandes.html.php', $vars);
	}

	public function roomsAction()
	{
		$rooms = json_decode($this->forward("DomotiqueBundle:Room:getAll")->getContent())->rooms;
		$vars = array(
			"rooms" => $rooms
		);
		return $this->render('DomotiqueBundle:Elements:rooms.html.php', $vars);
	}
    
}